<%@ page language="java" contentType="text/html; charset=UTF-8"
		 pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="tag" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />

<!DOCTYPE html>
<html>
<tag:head title="我的书架" ctx="${ctx}">
</tag:head>

<tag:body>
	<!-- 左 上 导航 -->
	<tag:nav ctx="${ctx}"></tag:nav>

	<!-- page content -->
	<div class="right_col" role="main">
		<div class="">
			<div class="clearfix"></div>

			<div class="row">
				<div class="col-md-12 col-sm-12 col-xs-12">
					<div class="x_panel">
						<div class="x_title">
							<h2>正在借阅</h2>
							<div class="clearfix"></div>
						</div>
						<div class="x_content">
							<c:if test="${fn:length(requestScope.borrows) == 0}">
								您的书架空空如也，快去借一些书给自己充电吧...
							</c:if>
							<c:forEach var="borrow" items="${requestScope.borrows}">
								<div class="col-md-55">
									<div class="thumbnail">
										<div class="image view view-first">
											<c:choose>
												<c:when test="${borrow.state == 0}">
													<span class="label label-success">取书中</span>
												</c:when>
												<c:when test="${borrow.state == 1}">
													<span class="label label-primary">阅读中</span>
												</c:when>
												<c:when test="${borrow.state == 2}">
													<span class="label label-info">归还中</span>
												</c:when>
												<c:when test="${borrow.state == 4}">
													<span class="label label-danger">已超期</span>
												</c:when>
												<c:when test="${borrow.state == 5}">
													<span class="label label-warning">已丢失</span>
												</c:when>
											</c:choose>

											<p class="borrowId" style="display: none;">${borrow.borrowId}</p>
											<img style="width: 100%; display: block;" src="${ctx}/${borrow.book.bookImage}" alt="image" />
											<div class="mask">
												<c:if test="${borrow.state != 4 && borrow.state != 3}">
													<h3 class="green"><i class="fa fa-paint-brush"></i> 还剩${borrow.endDays}天</h3>
												</c:if>
												<div class="tools tools-bottom">
													<c:choose>
														<c:when test="${borrow.state == 1}">
															<button type="button" class="btn btn-success btn-xs" data-toggle='modal' data-target='.bs-example-modal'>归还</button>
															<button type="button" class="btn btn-primary btn-xs" data-toggle='modal' data-target='.bs-example-modal'>续借</button>
															<button type="button" class="btn btn-danger btn-xs" data-toggle='modal' data-target='.bs-example-modal'>挂失</button>
														</c:when>
														<c:when test="${borrow.state == 2}">
															<div class="tags">
																<c:choose>
																	<c:when test="${fn:length(borrow.evaluates) == 0}">
																		<button type="button" id="evalue" class="btn btn-info btn-xs">评价</button>
																	</c:when>
																	<c:otherwise>
																		<button class="btn btn-success btn-xs" disabled>已评价</button>
																	</c:otherwise>
																</c:choose>
																<button type="button" class="btn btn-danger btn-xs" data-toggle='modal' data-target='.bs-example-modal'>挂失</button>
															</div>
														</c:when>
														<c:when test="${borrow.state == 4}">
															<div class="tags">
																<span class="label label-warning">请联系管理员</span>
															</div>
														</c:when>
														<c:when test="${borrow.state == 5}">
															<span class="label label-warning">请联系管理员</span>
														</c:when>
													</c:choose>
												</div>
											</div>
										</div>
										<div class="caption">
											<p>《<strong>${borrow.book.name}</strong>》</p>
												<label>已借天数:</label><span class="badge badge-success">${borrow.borrowDays}</span>
										</div>
									</div>
								</div>
							</c:forEach>
						</div>
						<div class="dataTables_paginate paging_simple_numbers" id="datatable-checkbox_paginate">
							<ul class="pagination">
								<li class="paginate_button previous disabled" id="datatable-checkbox_previous">
									<a href="javascript:void(0)" aria-controls="datatable-checkbox" data-dt-idx="0" tabindex="0">上一页</a>
								</li>
								<li class="paginate_button next disabled" id="datatable-checkbox_next">
									<a href="javascript:void(0)" aria-controls="datatable-checkbox" data-dt-idx="2" tabindex="0">下一页</a>
								</li>
							</ul>
						</div>
					</div>
				</div>

			</div>
			<div class="emptyRow"></div>



		</div>
	</div>
	<!-- /page content -->

	<!-- footer content -->
	<tag:footer></tag:footer>
</tag:body>
<!-- javascript -->
<tag:javascript ctx="${ctx}">
	<!-- this page -->
	<script src="${ctx}/assets/js/staff/staff_book_my/staff_book_my.js"></script>
	<script>
		createPaging($('#datatable-checkbox_paginate'),${requestScope.page.currentPageNum},${requestScope.page.totalPageNum},'myBooksPage(this)',10);
		adjustPagination($("#datatable-checkbox_paginate").children("ul"),${requestScope.page.currentPageNum},${requestScope.page.totalPageNum});
	</script>

</tag:javascript>
</html>

<!-- start:操作确认提示 -->
<div class="modal fade bs-example-modal" tabindex="-1" role="dialog" aria-hidden="true">
	<div class="modal-dialog modal-sm">
		<div class="modal-content">

			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
						aria-hidden="true">×</span>
				</button>
				<h4 class="modal-title">图书操作</h4>
			</div>
			<div class="modal-body">
				<h4></h4>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
				<button type="button" class="btn btn-primary">确定</button>
			</div>

		</div>
	</div>
</div>
<!-- end:操作确认提示 -->
